import { IPSDEUIPFPluginLogic } from './ipsdeuipfplugin-logic';
import { PSDEUILogicNodeImpl } from './psdeuilogic-node-impl';
import { IPSSysPFPlugin } from '../../res/ipssys-pfplugin';

export class PSDEUIPFPluginLogicImpl extends PSDEUILogicNodeImpl implements IPSDEUIPFPluginLogic {
  protected pssyspfplugin: IPSSysPFPlugin | null = null;

  getPSSysPFPlugin(): IPSSysPFPlugin | null {
    if (this.pssyspfplugin != null) return this.pssyspfplugin;
    const value = this.M.getPSSysPFPlugin;
    if (value == null) {
      return null;
    }
    this.pssyspfplugin = this.getPSModel4('res.IPSSysPFPlugin', value, 'getPSSysPFPlugin') as IPSSysPFPlugin;
    return this.pssyspfplugin;
  }

  get psSysPFPlugin(): IPSSysPFPlugin | null {
    return this.getPSSysPFPlugin();
  }

  getPSSysPFPluginMust(): IPSSysPFPlugin {
    const value = this.getPSSysPFPlugin();
    if (value == null) {
      throw new Error('未指定前端扩展插件');
    }
    return value;
  }

  get cls(): string {
    return 'PSDEUIPFPluginLogicImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'dataentity.logic.IPSDEUIPFPluginLogic') return true;
    return super.instanceof(cls);
  }
}
